package com.tms.project.tms.payoffs.service.impl;

import java.util.List;

import com.tms.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.tms.project.tms.payoffs.mapper.ScientificPayoffsMapper;
import com.tms.project.tms.payoffs.domain.ScientificPayoffs;
import com.tms.project.tms.payoffs.service.IScientificPayoffsService;
import com.tms.common.utils.text.Convert;

/**
 * 科研成果Service业务层处理
 *
 * @author xyl
 * @date 2021-03-26
 */
@Service
public class ScientificPayoffsServiceImpl implements IScientificPayoffsService {
    @Autowired
    private ScientificPayoffsMapper scientificPayoffsMapper;

    /**
     * 查询科研成果
     *
     * @param scientificPayoffsId 科研成果ID
     * @return 科研成果
     */
    @Override
    public ScientificPayoffs selectScientificPayoffsById(Long scientificPayoffsId) {
        return scientificPayoffsMapper.selectScientificPayoffsById(scientificPayoffsId);
    }

    /**
     * 查询科研成果列表
     *
     * @param scientificPayoffs 科研成果
     * @return 科研成果
     */
    @Override
    public List<ScientificPayoffs> selectScientificPayoffsList(ScientificPayoffs scientificPayoffs) {
        return scientificPayoffsMapper.selectScientificPayoffsList(scientificPayoffs);
    }

    /**
     * 新增科研成果
     *
     * @param scientificPayoffs 科研成果
     * @return 结果
     */
    @Override
    public int insertScientificPayoffs(ScientificPayoffs scientificPayoffs) {
        scientificPayoffs.setCreateTime(DateUtils.getNowDate());
        return scientificPayoffsMapper.insertScientificPayoffs(scientificPayoffs);
    }

    /**
     * 修改科研成果
     *
     * @param scientificPayoffs 科研成果
     * @return 结果
     */
    @Override
    public int updateScientificPayoffs(ScientificPayoffs scientificPayoffs) {
        scientificPayoffs.setUpdateTime(DateUtils.getNowDate());
        return scientificPayoffsMapper.updateScientificPayoffs(scientificPayoffs);
    }

    /**
     * 删除科研成果对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteScientificPayoffsByIds(String ids) {
        return scientificPayoffsMapper.deleteScientificPayoffsByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除科研成果信息
     *
     * @param scientificPayoffsId 科研成果ID
     * @return 结果
     */
    @Override
    public int deleteScientificPayoffsById(Long scientificPayoffsId) {
        return scientificPayoffsMapper.deleteScientificPayoffsById(scientificPayoffsId);
    }
}
